<?php
	####################################################
	# library import and object instance.              #
	####################################################
	# 커먼 인클루드
	include_once( '../common.php' );

	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)
	//$req = Request::clean_request($_REQUEST, FALSE);

	# GET(url variables)

	# POST(form variables)

	# Validation(special case validate)

	####################################################
	# implementation                                   #
	####################################################
	$sec->individual_access();

	$pagenation_cfg1 = array(
		'uri'				=> $PHP_SELF,
		'articles_count'	=> 50,
		'req_page'			=> empty($req['p1'])? 0 : $req['p1'],
		'page_size'			=> 6,
		'articles_cnt'		=> $db->getcnts('ggo_cfg_db_sessions'),
		'style'				=> Pagenation::$style_white,
		'get'				=> 'p1'
	);
	$sessarr = $dbsess->get_sessions_list($pagenation_cfg1['req_page'] * $pagenation_cfg1['articles_count'], $pagenation_cfg1['articles_count']);
	$pagenation1 = Pagenation::out($pagenation_cfg1);
	//Nlog::puts('sessarr',$sessarr);
?>
<?php
	# HTML START
	echo $html->custom_header(TITLE);
	echo $tplt->page_construct_javascript();
	echo $html->custom_js("{$JS}common.js");
	echo $html->custom_css("{$CSS}common.css");
	echo $html->custom_body();
?>
	<?php $tplt->app_head($NAVI)?>
	<?php $tplt->tiles_admin_sidebar($NAVI)?>
	<?php $tplt->tiles_admin_contents($pkname, $pname, $pdesc)?>

		<h4>세션매니저</h4>
		<?php echo NForm::open(NULL, FALSE, "list");?>
			<?php echo NForm::mode('modify')?>
			<table class="tbl" width="100%" border="1" cellspacing="3" cellpadding="3" style="border-collapse:collapse;">
				<colgroup>
					<col width="20" />
					<col width="210" />
					<col width="*" />
					<col width="83" />
					<col width="80" />
					<col width="60" />
					<col width="130" />
				</colgroup>
				<tr>
					<th><input type="checkbox" id="chkctr1" onclick="CheckboxControl.toggle_check_all('#chkctr1','.chk1');"/></th>
					<th>세션 키<br />session_key</th>
					<th>세션 값(JSON)<br />session_value</th>
					<th>세션 만료<br />session_expiry</th>
					<th>세션 체크(도메인)<br />session_check</th>
					<th>ip</th>
					<th>세션 생성일<br />ldate</th>
				</tr>
				<?php if($sessarr['has']) foreach($sessarr['res'] as $key=>$val): ?>
					<tr>
						<td><input type="checkbox" name="map[<?=$val['session_key']?>][session_key]" id="chk1_<?=$val['session_key']?>" class="chk1" value="<?=$val['session_key']?>"></td>
						<td><?=$val['session_key']?></td>
						<td>
							<textarea name="map[<?=$val['session_key']?>][session_value]" value="<?=$val['session_value']?>" onfocus="CheckboxUi.focus_to_check('#chk1_<?=$val['session_key']?>');" rows="10" class="inp wmatch h90 ti0" style="font:normal 16px/16px 'Fixedsys Excelsior 3.01';"><?=$val['session_value']?></textarea>
						</td>
						<td class="ti0 tac">
							<?=$val['session_expiry']?><br /><br />
							<?=TimeAndDate::unixtime_to_date($val['session_expiry']);?>
						</td>
						<td><?=$val['session_check']?></td>
						<td><?=$val['ip']?></td>
						<td><?=$val['ldate']?></td>
					</tr>
				<?php endforeach; ?>
			</table>
		<?php echo NForm::close();?>
		<div class="tblt">
			<?=$pagenation1?>
		</div>
		<div class="tblh">
			체크된 세션데이터를 : <span class="cbtn_s" onclick="$('#formx_list').submit();">수정</span>&nbsp;
			체크된 세션데이터를 : <span class="cbtn_l" onclick="$('#formx_list [name=mode]').val('delete'); $('#formx_list').submit();">삭제(kill)</span>&nbsp;
		</div>
		<br />


<?php
	# HTML END
	echo $tplt->tiles_admin_footer();
	echo $tplt->page_destruct_javascript();
	include_once( '../endproc.php' );
	echo $html->html_footer();
?>